<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <title>选择分类</title>
    <link rel="stylesheet" href="../../css/api.css">
    <link rel="stylesheet" href="../../css/main.css">
    <link rel="stylesheet" href="../../css/addr-page.css">
    <link rel="stylesheet" href="../../css/vant.css">
</head>
<style scoped>
    .select-category {
        background: #ffffff;
        margin-top: 124px;
    }

    .select-category-title {
        width: 100%;
        background: #ffffff;
        border-bottom: 0.5px solid #dddddd;
        padding-left: 20px;
    }

    .select-category-title span {
        font-size: 16px;
        font-weight: 500;
        color: #3F8CEC;
        border-bottom: 2px solid #3F8CEC;
        line-height: 44px;
    }

    .select-category-item {
        margin-left: 20px;
        font-size: 14px;
        font-weight: 400;
        color: #41485D;
        line-height: 44px;
        border-bottom: 0.5px solid #dddddd;
    }

    .select-category-title {
        position: fixed;
        top: 76px;
    }

    body::-webkit-scrollbar {
        display: none;
    }
</style>

<body>
    <div class="app" v-cloak>
        <header>
            <div class="flex-x-sb ">
                <span class="iconfont goback" @click="backPage">&#xe66f;</span>
                <div class="title">选择分类</div>
            </div>

        </header>
        <div class="select-category-title">
            <span>请选择</span>
        </div>
        <div class="select-category">
            <div class="select-category-item" v-for="(item, index) in categoryList" :key="index"
                @click="selectCategory(item)">
                {{item.name}}
            </div>
        </div>

    </div>
    <script src="../../script/api.js "></script>
    <script src="../../script/flexible.js "></script>
    <script src="../../script/fastclick.js "></script>
    <script src="../../script/vue.min.js "></script>
    <script src="../../script/iconfont.js "></script>
    <script src="../../script/vant.min.js"></script>
    <script src="../../script/common.js "></script>
    <script src="../../script/restful.js "></script>
    <script src="../../script/businessCommon.js "></script>
    <script>
        apiready = function () {
            let vm = new Vue({
                el: ".app",
                data() {
                    return {
                        //请求分类列表的数据
                        queryCategoryList: {
                            pageNum: 1,
                            pageSize: 10000,
                            status: 1
                        },
                        categoryList: []
                    }
                },
                created() {
                    this.getCategoryList()//获取分类数据
                },
                mounted() {
         
                },
                methods: {
                    getCategoryList() {
                        var vm = this;
                        index.deformedSteel("getDeformedCategoryList")(this.queryCategoryList, function (ret) {
                            vm.categoryList = ret.data.list;
                        })
                    },
                    /**
                     * 选择分类
                     * */
                    selectCategory(item) {
                        api.sendEvent({
                            name: 'selectCategory',
                            extra: {
                                id: item.id,
                                name:item.name
                            }
                        })
                        setTimeout(() => {
                            vm.backPage();
                        }, 200);
                    },
                    backPage() {
                        api.closeWin();
                    },
                }
            })
        }
    </script>
</body>

</html>